using System;
using Oracle.ManagedDataAccess.Client;
using OracleInternal.Common;

namespace OracleInternal.TTC
{
	internal class TTCSwitchSession : TTCFunction
	{
		internal static int OSESSWS = 1;

		internal static int OSESGID = 2;

		internal static int OSESDET = 3;

		internal static int OSESDEL = 4;

		internal static int OSESCLN = 5;

		internal static int OSESINI = 6;

		internal static int OSESSWB = 7;

		internal TTCSwitchSession(MarshallingEngine mEngine)
			: base(mEngine, 107, 0)
		{
			m_ttcCode = 17;
		}

		internal void Write(int sessionId, int serialNum, int opCode)
		{
			if (ProviderConfig.m_bTraceLevelPrivate)
			{
				Trace.Write(OracleTraceLevel.Private, (OracleTraceTag)131328, OracleTraceClassName.TTCSwitchSession, OracleTraceFuncName.Write);
			}
			try
			{
				WriteFunctionHeader();
				m_marshallingEngine.MarshalUB4(sessionId);
				m_marshallingEngine.MarshalUB4(serialNum);
				m_marshallingEngine.MarshalUB4(opCode);
			}
			catch (Exception ex)
			{
				OracleException.HandleError(OracleTraceLevel.Private, (OracleTraceTag)268566528, OracleTraceClassName.TTCSwitchSession, OracleTraceFuncName.Write, ex);
				throw;
			}
			finally
			{
				if (ProviderConfig.m_bTraceLevelPrivate)
				{
					Trace.Write(OracleTraceLevel.Private, (OracleTraceTag)131584, OracleTraceClassName.TTCSwitchSession, OracleTraceFuncName.Write);
				}
			}
		}
	}
}
